QuinticP = (p) -> (
     R = ZZ/p[a,b,c,e,f,m,x,y,z,t];
          
     A = a^2 - 2*a - 4;
     B = 4*a^8 + 24*a^7 + 4*a^6 - 32*a^5 + 144*a^4 + 64*a^3 - 48*a^2 + 12;
     C = 4*a^6 + 24*a^5 + 4*a^4 - 32*a^3 + 144*a^2 + 64*a - 48;
     E = a^4 + 2*a^3 - 4*a^2 + 8*a + 4;
     F = 4*a^11 + 28*a^10 + 28*a^9 - 28*a^8 + 112*a^7 + 208*a^6 + 16*a^5 - 32*a^4 + 8*a^3 - 64*a^2 + 128*a + 64;
     M = 4/a^2;
          
     A=sub(A,R);
     B=sub(B,R);
     C=sub(C,R);
     E=sub(E,R);
     F=sub(F,R);
     M=sub(M,R);
     
     quintic=(x+m*y+a*z)^2*t^3+(a^2*x^3+x*y*(b*x+c*y)+m^2*y^3+(e*x^2+f*x*y+c*y^2)*z+(b*x+e*y)*z^2+z^3)*t^2+(2*a*x^3*y+e*x^2*y^2+2*a*m*x*y^3+(2*a*m*x^3+f*x^2*y+f*x*y^2+2*m*y^3)*z+(c*x^2+f*x*y+b*y^2)*z^2+2*(m*x+a*y)*z^3)*t+x^3*y^2+a^2*x^2*y^3+x*y*z*(2*m*x^2+b*x*y+2*a*y^2)+z^2*(m^2*x^3+c*x^2*y+e*x*y^2+y^3)+(m*x+a*y)^2*z^3;
     myquintic=sub(quintic,{a=>A,b=>B,c=>C,e=>E,f=>F,m=>M});
     
     myquintic);


Sing = (p) -> (
     myquintic=QuinticP(p);
     
     R1=ZZ/p[a,x,y,z,t];
     myquintic=sub(myquintic,R1);
     
     Der1=diff(x,myquintic);
     Der2=diff(y,myquintic);
     Der3=diff(z,myquintic);
     Der4=diff(t,myquintic);
     J=ideal(Der1, Der2, Der3, Der4, a^2 - 2*a - 4); --this is the ideal of polynomials for which every singular point must be a zero
     
     J);

RunExperiment = () -> (
     primes={3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229};
     for p in primes do(print(p,codim(Sing(p)),degree(Sing(p))));
     );

--SingMinusZero = (p) -> (  
  --   R1=ZZ/p[r,x,y,z,t];
  --     I=Sing(p):ideal(x,y,z); --this is my attempt to find the ideal of polynomials which vanish at all singular points except (0,0,0,1)
  --   I);